<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>自媒体报价</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/layui/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="/layui/css/public.css" media="all">
    <style>
        .layui-form-item .layui-input-company {width: auto;padding-right: 10px;line-height: 38px;}


         .layui-form-label{
             width: 90px;
         }
    </style>
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        <div class="layui-form layuimini-form">
            <input type="hidden" value="${mediaAccount.id}" name="id" id="id">
            <div class="layui-form-item">
                <label class="layui-form-label required">账号名</label>
                <div class="layui-input-block">
                    <input type="text" value="${mediaAccount.username}" disabled lay-verify="required" lay-reqtext="账号名不能为空" placeholder="请输入账号名" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">姓名</label>
                <div class="layui-input-block">
                    <input type="text" value="${mediaAccount.accountName}" disabled lay-verify="required" lay-reqtext="姓名不能为空" placeholder="请输入姓名" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">广告类型</label>
                <div class="layui-input-block">
                    <input type="text" name="adType" id="adType" value="${price.price.adType}" lay-verify="required" lay-reqtext="广告类型不能为空" placeholder="请输入广告类型" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">广告报价有效期</label>
                <div class="layui-input-block">
                    <input type="datetime-local" name="endTime" id="endTime" value="<fmt:formatDate pattern='yyyy-MM-dd HH:mm:ss' type='date' value='${price.price.endTime}'/>" required="required" lay-verify="required" lay-reqtext="广告报价有效期不能为空" placeholder="请输入广告报价有效期" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">价格</label>
                <div class="layui-input-block">
                    <input type="text" name="price" id="price" value="${price.price.price}" lay-verify="required" lay-reqtext="价格不能为空" placeholder="请输入价格" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="/layui/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script src="/layui/js/lay-config.js?v=1.0.4" charset="utf-8"></script>

<script>
    layui.use(['form', 'upload', 'layedit'], function () {
        var form = layui.form,
            layer = layui.layer,
            upload = layui.upload,
            layedit = layui.layedit,
            $ = layui.$;

        //监听提交
        form.on('submit(saveBtn)', function (data) {
            var adType = $("#adType").val();
            var date = $("#endTime").val();
            const endTime = new Date(date); // 转换时间让后台可以接收数据
            var price = $("#price").val();
            var id = $("#id").val();
            $.ajax({
                url: '/mediaAccountLogin/quotationUpdate',
                type: 'post',
                data: {"adType": adType, "endTime": endTime, "price": price, "id": id},
                dataType: 'json',
                success: function (result) {
                    if (result.code == '0') {
                        window.location = '/welcome';
                    }
                }
            });
            return false;
        });
    });
</script>
<%--<script>--%>
<%--    layui.use(['form','miniTab'], function () {--%>
<%--        var form = layui.form,--%>
<%--            layer = layui.layer,--%>
<%--            miniTab = layui.miniTab;--%>

<%--        //监听提交--%>
<%--        form.on('submit(saveBtn)', function (data) {--%>
<%--            var index = layer.alert(JSON.stringify(data.field), {--%>
<%--                title: '最终的提交信息'--%>
<%--            }, function () {--%>
<%--                layer.close(index);--%>
<%--                miniTab.deleteCurrentByIframe();--%>
<%--            });--%>
<%--            return false;--%>
<%--        });--%>

<%--    });--%>
<%--</script>--%>
</body>
</html>
